<?php
namespace app\index\controller;
use think\Controller;

class Index extends Base
{
    public function index()
    {
        // 获取首页大图 相关数据
        $bigfeatureds=model('Featured')->getFeaturedsByTypeStatusLimit(0,1,5);
        $adsfeatureds=model('Featured')->getFeaturedsByTypeStatusLimit(1,1,1);
        // 获取广告位相关的数据
        // 商品分类 数据-美食 推荐的数据
        // 获取4个子分类
        $fooddatas = model('Deal')->getNormalDealByCategoryCityId(1, $this->city->id, 5);
        $foodcates = model('Category')->getNormalRecommendCategoryByParentId(1, 4);

        $filmdatas = model('Deal')->getNormalDealByCategoryCityId(4, $this->city->id, 5);
        $filmcates = model('Category')->getNormalRecommendCategoryByParentId(4, 4);

        $hoteldatas = model('Deal')->getNormalDealByCategoryCityId(7, $this->city->id, 5);
        $hotelcates = model('Category')->getNormalRecommendCategoryByParentId(7, 4);

        $leisuredatas = model('Deal')->getNormalDealByCategoryCityId(13, $this->city->id, 5);
        $leisurecates = model('Category')->getNormalRecommendCategoryByParentId(13, 4);

        $traveldatas = model('Deal')->getNormalDealByCategoryCityId(10, $this->city->id, 5);
        $travelcates = model('Category')->getNormalRecommendCategoryByParentId(10, 4);

        return $this->fetch('',[
            'bigfeatureds' =>$bigfeatureds,
            'adsfeatureds' =>$adsfeatureds,
            'fooddatas' => $fooddatas,
            'foodcates' => $foodcates,
            'filmdatas' => $filmdatas,
            'filmcates' => $filmcates,
            'hoteldatas' => $hoteldatas,
            'hotelcates' => $hotelcates,
            'leisuredatas' => $leisuredatas,
            'leisurecates' => $leisurecates,
            'traveldatas' => $traveldatas,
            'travelcates' => $travelcates,
            'controller' => 'ms',
        ]);
    }
}
